{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b8d1cc34",
   "metadata": {},
   "source": [
    "## 上周回顾\n",
    "> * 1.list的一般方法、函数的使用及案例，如：\n",
    ">> 1. append() 增加，增加list元素到list的末尾，常用于新建列表\n",
    ">> 2. pop(index)/remove(values) 对比两者优势\n",
    ">> 3. count() 查看某个元素出现的次数\n",
    ">> 4. index() 查看某个元素第一次出现的位置\n",
    ">> 5. extend() 两个list合并在一起，也可用[]+[]来实现\n",
    "\n",
    "> * 2. list的高级用法\n",
    ">> 1. copy() list(可变的数据类型）复制 不等价于 赋值，可用[:]来实现\n",
    ">> 2. enmerate() 枚举，可同时遍历并获取index和values\n",
    "\n",
    "## 本周内容: \n",
    "### list练习，vowels.py vowels2.py\n",
    "### list实践 : \n",
    "### 初始字典 ："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "00c372a6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "vowels = ['a','e','i','o','u']\n",
    "word = \"Milliways\"\n",
    "# 检查 word中出现的元音，并打印出来 怎么做？\n",
    "# for letter in wors:    #  第一个元素letter 请不要和已有变量重名\n",
    "                         #  第一个元素一般不定义名字，常用item(元素)来命名\n",
    "                         #                            简写 i 来命名\n",
    "                        # 第二个元素（重要），意味着遍历的内容\n",
    "                         #  遍历的内容一般是 序列数据 str list\n",
    "for letter in word: \n",
    "#     print(letter)\n",
    "    if letter in vowels: \n",
    "        print(letter)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1b3b1551",
   "metadata": {},
   "source": [
    "> * vowels2.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "c6baea55",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'wors' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-11-ae9dc161db06>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m# 使用appen() 新建列表\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[0mfound\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mfor\u001b[0m \u001b[0mletter\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mwors\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      4\u001b[0m \u001b[1;31m# print(letter)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m     \u001b[1;32mif\u001b[0m \u001b[0mletter\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mvowels\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;31m# letter在 元音字母表中\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNameError\u001b[0m: name 'wors' is not defined"
     ]
    }
   ],
   "source": [
    "# 使用appen() 新建列表\n",
    "found = []\n",
    "for letter in wors: \n",
    "# print(letter)\n",
    "    if letter in vowels: # letter在 元音字母表中\n",
    "        if found not in letter: # letter 不在found表中\n",
    "            found.append(letter)\n",
    "            founs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "279990b1",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-12-74ea63c6fb69>, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-12-74ea63c6fb69>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m    用户输入 打印信息\u001b[0m\n\u001b[1;37m         ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "用户输入 打印信息 \n",
    "购买 appen增加"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "fcaddd91",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入支付宝余额60\n",
      "------ goods list-----\n",
      "商品编号 : 0,商品名称 ：a,商品价格 : 60\n",
      "商品编号 : 1,商品名称 ：b,商品价格 : 8000\n",
      "商品编号 : 2,商品名称 ：c,商品价格 : 199\n",
      "商品编号 : 3,商品名称 ：d,商品价格 : 8\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# 商品信息的数据存放（商品名称、商品价格，商品编号）\n",
    "goods_list = [[\"a\",60],[\"b\",8000],[\"c\",199],[\"d\",8]]\n",
    "\n",
    "# 用户购物信息的数据存放\n",
    "user_shopping_list = [] # 增加可考虑用append（）\n",
    "# 用户输入余额信息\n",
    "Alipay = input(\"请输入支付宝余额\")\n",
    "# 打印商品信息\n",
    "# info = '''------ goods list-----\n",
    "# 商品编号：%s，商品名称：%s,商品价格: %s元\n",
    "# 商品编号：%s，商品名称：%s,商品价格: %s元\n",
    "# 商品编号：%s，商品名称：%s,商品价格: %s元\n",
    "# 商品编号：%s，商品名称：%s,商品价格: %s元\n",
    "# '''%(0,goods_list[0][0],goods_list[0][1],\n",
    "# 1,goods_list[1][0],goods_list[1][1]\n",
    "# 2,goods_list[0][0],goods_list[0][1])\n",
    "\n",
    "\n",
    "print('------ goods list-----')\n",
    "for i in range (len(good_list)): \n",
    "    print(\"商品编号：%s，商品名称：%s,商品价格: %s\n",
    "          元\"(i,goods_list[i][0],goods_list[i][1]))\n",
    "    \n",
    "# 用户输入商品编号，实现商品的查询\n",
    "choice = int(input(\"请输入商品的编号\"))\n",
    "# 判断编号是否存在\n",
    "if choice < len(goods_list): \n",
    "pass\n",
    "  else: \n",
    "print(\"请输入正确的商品编号，您输入的商品不存在\")\n",
    "          \n",
    "          if choice"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "390dbb07",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
